package com.digital.smartgrow.service.business.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.digital.smartgrow.dto.business.UpJobPageDTO;
import com.digital.smartgrow.entity.business.UpJob;
import com.digital.smartgrow.dao.business.UpJobMapper;
import com.digital.smartgrow.service.business.UpJobService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 职评表 服务实现类
 * </p>
 *
 * @author sunyuechao
 * @since 2022-07-13
 */
@Service
public class UpJobServiceImpl extends ServiceImpl<UpJobMapper, UpJob> implements UpJobService {

    @Override
    public Object getListByPage(UpJobPageDTO pageDTO) {
        Page<UpJob> page = new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize());
        QueryWrapper<UpJob> queryWrapper = new QueryWrapper<>();
        //queryWrapper.like(StringUtils.isNotBlank(pageDTO.getEmployeeId()), "employeeId", pageDTO.getEmployeeId());
        queryWrapper.eq(StringUtils.isNotBlank(pageDTO.getArchives()), "archives", pageDTO.getArchives());
        queryWrapper.eq(StringUtils.isNotBlank(pageDTO.getYear()), "year", pageDTO.getYear());

        return this.page(page, queryWrapper);
    }

    @Override
    public UpJob getInfo(Integer id) {
        return this.getById(id);
    }
}
